package org.aldar.bquest.logic.controller.level;

import org.aldar.bquest.constants.LandscapeType;
import org.aldar.bquest.entity.AbilityTileSprite;
import org.aldar.bquest.entity.LandscapeArea;

import java.util.LinkedList;
import java.util.List;

/**
 * User: Daria
 * Date: 6/8/13 8:21 PM
 */
public class LevelDef {

    public LandscapeType[] lsTypesBoard;

    private AbilityTileSprite.AbilityType[] abilityTypes = new AbilityTileSprite.AbilityType[]{
            AbilityTileSprite.AbilityType.MOVE_HERO,
            AbilityTileSprite.AbilityType.MISSILE,
            AbilityTileSprite.AbilityType.EXPLODE_9,
            AbilityTileSprite.AbilityType.COLLECT_CRYSTALS
    };


    private LandscapeArea[] landscapeAreas;

    private List<Integer> enemyIndexes;

    private int length;

    private int numberOfTowns;

    private int minLandscapeLength;

    private int maxLandscapeLength;

    private int movesAllowed;

    private int maxFame = 0;

    public LevelDef(LandscapeArea[] landscapeAreas, LandscapeType[] lsTypesBoard, int[] enemyIndexes, AbilityTileSprite.AbilityType[] abilityTypes) {
        this.landscapeAreas = landscapeAreas;
        this.length = landscapeAreas.length;
        this.enemyIndexes = new LinkedList<Integer>();
        if (enemyIndexes != null) {
            for (int i = 0; i < enemyIndexes.length; i++) {
                this.enemyIndexes.add(enemyIndexes[i]);
            }
        }
        this.lsTypesBoard = lsTypesBoard;
        for (LandscapeArea la : landscapeAreas) {
            if (la.getNotesForTown() > 0) {
                this.maxFame += la.getNotesForTown();
            }
        }

        if (abilityTypes != null) {
            this.abilityTypes = abilityTypes;
        }
    }

    public LevelDef(LandscapeArea[] landscapeAreas, LandscapeType[] lsTypesBoard) {
        this(landscapeAreas, lsTypesBoard, null, null);
    }

    public LevelDef(LandscapeArea[] landscapeAreas, LandscapeType[] lsTypesBoard, AbilityTileSprite.AbilityType[] abilityTypes) {
        this(landscapeAreas, lsTypesBoard, null, abilityTypes);
    }

    /*
    public LevelDef(int length, int numberOfTowns, int minLandscapeLength, int maxLandscapeLength, int maxMoves) {
        this.length = length;
        this.numberOfTowns = numberOfTowns;
        this.minLandscapeLength = minLandscapeLength;
        this.maxLandscapeLength = maxLandscapeLength;
        this.movesAllowed = maxMoves;
    }

    public LevelDef(LandscapeArea[] landscapeAreas, int[] enemyIndexes, CloudSettings cloudSettings, ManaSettings manaSettings) {
        this.landscapeAreas = landscapeAreas;
        this.length = landscapeAreas.length;
        this.enemyIndexes = new LinkedList<Integer>();
        for (int i = 0; i < enemyIndexes.length; i++) {
            this.enemyIndexes.add(enemyIndexes[i]);
        }
        this.cloudSettings = cloudSettings;
        this.manaSettings = manaSettings;
    }

    public LevelDef(LandscapeArea[] landscapeAreas, LandscapeType[] lsTypesBoard, AbilityTileSprite.AbilityType[] abilityTypes, int[] enemyIndexes, CloudSettings cloudSettings, ManaSettings manaSettings, GameTutorial.TutorialSection[] sectionsToShow) {
        this.landscapeAreas = landscapeAreas;
        this.length = landscapeAreas.length;
        this.enemyIndexes = new LinkedList<Integer>();
        for (int i = 0; i < enemyIndexes.length; i++) {
            this.enemyIndexes.add(enemyIndexes[i]);
        }
        this.cloudSettings = cloudSettings;
        this.manaSettings = manaSettings;
        this.lsTypesBoard = lsTypesBoard;
        this.abilityTypes = abilityTypes;
        this.sectionsToShow = sectionsToShow;
        for (LandscapeArea la : landscapeAreas) {
            if (la.getNotesForTown() > 0) {
                this.maxFame += la.getNotesForTown();
            }
        }
    }

*/
    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getNumberOfTowns() {
        return numberOfTowns;
    }

    public void setNumberOfTowns(int numberOfTowns) {
        this.numberOfTowns = numberOfTowns;
    }

    public int getMinLandscapeLength() {
        return minLandscapeLength;
    }

    public void setMinLandscapeLength(int minLandscapeLength) {
        this.minLandscapeLength = minLandscapeLength;
    }

    public int getMaxLandscapeLength() {
        return maxLandscapeLength;
    }

    public void setMaxLandscapeLength(int maxLandscapeLength) {
        this.maxLandscapeLength = maxLandscapeLength;
    }

    public int getMovesAllowed() {
        return movesAllowed;
    }

    public void setMovesAllowed(int movesAllowed) {
        this.movesAllowed = movesAllowed;
    }

    public LandscapeArea[] getLandscapeAreas() {
        return landscapeAreas;
    }

    public List<Integer> getEnemyIndexes() {
        return enemyIndexes;
    }

    public AbilityTileSprite.AbilityType[] getAbilityTypes() {
        return abilityTypes;
    }

    public int getMaxFame() {
        return maxFame;
    }
}
